package yodoo

import (
	"encoding/json"
	"strings"
)

// 定义结构体
type tThirdAuthData struct {
	Username string `json:"fromUser"`
	Password string `json:"passwd"`
}

func ThirdAuthDataDecode(key, encrypt string) (u string, p string, e error) {
	raw, err := AesDecrypt(encrypt, key)
	if err != nil {
		return "", "", err
	}
	var data tThirdAuthData
	err = json.NewDecoder(strings.NewReader(string(raw.Data))).Decode(&data)
	if err != nil {
		return "", "", err
	}
	return data.Username, data.Password, nil
}

func ThirdAuthDataEncode(key, text string) (encrypt string, err error) {

	return "", nil
}
